<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.seeyon.v3x.common.constants.ApplicationCategoryEnum" %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@ include file="../edocHeader.jsp" %>
<script type="text/javascript" charset="UTF-8" src="<c:url value="/apps_res/edoc/js/edocCategory.js${v3x:resSuffix()}" />"></script>
<script>
  formOperation = "aa";
  var logoURL = "${logoURL}";
</script>
<style type="text/css">
.categorySet-body-edocform{
	border-left: solid 1px #a0a0a0;
	border-right: solid 1px #a0a0a0;
	border-bottom: solid 1px #a0a0a0;
	border-top: solid 1px #a0a0a0;
	padding: 10px;
	margin: 0px;
	background-color: #FFFFFF;
	float: left;
	clear: left;
	height: 100%;
	width: 100%;
	overflow: auto;
}
</style>
<title></title>
        <script type="text/javascript">
    	function edocFormDisplay(fileId,fileName,createDate){
    		//var str="<A HREF=\"/seeyon/fileUpload.do?method=download&fileId="+detail[0]+"&createDate="+detail[1].substring(0,10)+"&filename="+encodeURI(detail[2])+"&deleteFile=\"false\""+" target=\"_blank\" \><fmt:message key="edoc.form.downloadform" /></A>";
			var isSystemForm='${bean.isSystem}'; //系统预置公文单
			var formType = "${bean.type }";
			var str="<A HREF=\"/seeyon/fileUpload.do?method=download&isSystemForm="+isSystemForm+"&formType="+formType+"&fileId="+fileId+"&createDate="+createDate+"&filename="+encodeURI(fileName)+"\" target=\"temp_iframe\" \><fmt:message key="edoc.form.downloadform" /></A>";
			var obj = document.getElementById("download");
			if(obj!=null){
				obj.innerHTML = str; 
			}
    		var xml = document.getElementById("xml");
			var xsl = document.getElementById("xsl");
            buttondnois();
			document.getElementById("content").value = xsl.value;
			
			if(xml!=null && xml!="" && xsl!=null && xsl!=""){
				try{
    				initSeeyonForm(xml.value,xsl.value);
    				/**xiangfan 添加修复GOV-3811 Start*/
    				if(document.getElementById("my:send_department") != null){
    					document.getElementById("my:send_department").value = "";
    				}
    				/**xiangfan 添加修复GOV-3811 End */
				}catch(e){
					alert(_("edocLang.edoc_form_xml_error") +e);
					var eDiv = document.getElementById("divA");
					if(eDiv){
						eDiv.style.display = "";
					}
					return false;
				}
				substituteLogo(logoURL);
    			return false;
    		}
    		

    	}
    	
    function newcategory(){
		insertAttachment();
		var atts = fileUploadAttachments.values();
		if(atts == "")
			return false;

		//向后续页面传递附件字符串。
		saveAttachment();
		var attachmentStr = document.getElementById("attachmentStr");
		var attachmentInputs = document.getElementById("attachmentInputs");
		if(attachmentInputs && attachmentStr){
			attachmentStr.value = attachmentInputs.innerHTML;
		}
		
		var form=document.getElementById("modifyForm");
		for(var i = 0; i< atts.size(); i++){
			var att = atts.get(i);
			document.getElementById("att_fileUrl").value = att.fileUrl;
			document.getElementById("att_createDate").value = att.createDate;
			document.getElementById("att_mimeType").value = att.mimeType;
			document.getElementById("att_filename").value = att.filename;
			document.getElementById("att_needClone").value = att.needClone;
			document.getElementById("att_description").value = att.description;
			document.getElementById("att_type").value = att.type;
			document.getElementById("att_size").value = att.size;
	        var field = document.createElement
	    ('<INPUT TYPE="hidden" name="fileUrl" value="'+att.fileUrl+ '" />');
	        var field1 = document.createElement
	    ('<INPUT TYPE="hidden" name="fileCreateDate" value="'+att.createDate+ '" />');
	    var field2 = document.createElement
	    ('<INPUT TYPE="hidden" name="fileMimeType" value="'+att.mimeType+ '" />');
	    var field3 = document.createElement
	    ('<INPUT TYPE="hidden" name="filename" value="'+att.filename+ '" />');
	    form.appendChild(field);
	    form.appendChild(field1);
	    form.appendChild(field2);
	    form.appendChild(field3);
	    //--
	    document.getElementById("file_name").value = att.filename;
	    
	    var file_n = att.filename;
		var suffix = file_n.substring(file_n.indexOf(".")+1,file_n.length);
		
		/*
		if(suffix!="xsn"){
			alert(_("edocLang.edoc_alertMustBeXsnFormat"));
			window.location.reload();
			return false;
		}
		*/
	    //--
		}
		form.target="detailFrame";
		form.action = "${edocForm}?method=uploadForm&";
		form.method = "POST";
		form.submit();
	}

	function modify_submit(listStr, content){

	var form = document.getElementById("modifyForm");
	//if(form.isSystem && (form.isSystem.value == 'true' || form.isSystem.value == true) && content != 'empty'){
	//	alert(_("edocLang.edoc_form_system_change_forbidden"));
	//	return;
	//}
	if(!checkForm(form))
	return;//验证form
	var name = document.getElementById("name");
	if(name.value == ""){
		alert(_("edocLang.edoc_inputSubject"));
		return false;
	}
	
	/*
	if(listStr!=null && listStr != ""){
	var tempS = listStr.split(",");
	for(var i=0;i<tempS.length;i++){
		var value = document.getElementById(tempS[i]).value;
		
		if(value == ""){
			alert(_('edocLang.edoc_form_flowperm_bound_alert'));
			return false;
		}
	}
	}
	*/
	
	/*
		check whether the name is duplicated or not.
	*/
	var type = document.getElementById("type");
	var id = document.getElementById("id");
	try {
		var requestCaller = new XMLHttpRequestCaller(this, "ajaxEdocFormManager", "ajaxCheckDuplicatedName",false);
		requestCaller.addParameter(1, "String", name.value);
		requestCaller.addParameter(2, "String", type.value);
		requestCaller.addParameter(3, "String", id.value);
		var ds = requestCaller.serviceRequest();
		if(ds == "true"){
			alert(_("edocLang.edoc_form_duplicated_name"));
			return;
		}
	}catch(ex1){
	
	}
		try{
    		var requestCaller = new XMLHttpRequestCaller(this, "ajaxEdocFormManager", "ajaxCheckFormIsIdealy", false);
    		requestCaller.addParameter(1, "String", id.value);
    		requestCaller.addParameter(2, "String", "param1");
    		requestCaller.addParameter(3, "String", "");    		    		
    		var ds = requestCaller.serviceRequest();
    		var stats = document.getElementsByName("status");
    		var status = "1";
    		for(var i=0;i<stats.length;i++){
    			if(stats[i].checked){
    				status = stats[i].value;
    			}
    		}
    		if(ds == "true" && status == "0"){
    			alert(_("edocLang.edoc_alertDefaultForm_NotForbidden"));
    			return;
    		}
    		//默认公文单步允许禁止。
    		var isDefault=document.getElementsByName("isDefault");
    		if(isDefault[0].checked&& status == "0"){
    			alert(_("edocLang.edoc_alertDefaultForm_Not_Forbidden"));
    			return;
    		}
    	}catch(e){
    	}
	
	form.target = "detailFrame";
	buttondis();
	form.action="${edocForm}?method=change&listStr="+encodeURI(listStr);
	form.method = "POST";
	var xml = document.getElementById("xml").value;
	var xsl = document.getElementById("xsl").value;
	var spanObjs=document.getElementsByTagName("span");
	var str = "";
	var key;
	for(i=0;i<spanObjs.length;i++)
	{		
		key=spanObjs[i].getAttribute("xd:binding");	
		if(key!=null)
		{
			str += key;
			str += "|";
		}
	}
	saveAttachment();
	
	var html = document.getElementById("html");

	if(html ==null || html.value=="" ){
		alert(_("edocLang.edoc_alertUploadOneEdocForm"));
		buttondnois();
		return false;
	}
	
	document.getElementById("mx").value = str.substring(0,str.length-1);
	form.submit();
	}
	
		function fieldChoose(){
		var obj1 = document.getElementById("tag0-left");
		obj1.className = "tab-tag-left-sel";
		var obj2 = document.getElementById("tag0-middel");
		obj2.className = "tab-tag-middel-sel";
		var obj3 = document.getElementById("tag0-right");
		obj3.className = "tab-tag-right-sel";
		var obj4 = document.getElementById("tag1-left");
		obj4.className = "tab-tag-left";
		var obj5 = document.getElementById("tag1-middel");
		obj5.className = "tab-tag-middel";
		var obj6 = document.getElementById("tag1-right");
		obj6.className = "tab-tag-right";
		
		var obj_a = document.getElementById("fieldOne");
		obj_a.style.display = "";
		var obj_b = document.getElementById("fieldTwo");
		obj_b.style.display = "none";

		var tab = document.getElementById("mainTable");
		tab.className = "categorySet";
		tab.width = "100%";
	}
	function chooseReverse(){
		var obj1 = document.getElementById("tag0-left");
		obj1.className = "tab-tag-left";
		var obj2 = document.getElementById("tag0-middel");
		obj2.className = "tab-tag-middel";
		var obj3 = document.getElementById("tag0-right");
		obj3.className = "tab-tag-right";
		var obj4 = document.getElementById("tag1-left");
		obj4.className = "tab-tag-left-sel";
		var obj5 = document.getElementById("tag1-middel");
		obj5.className = "tab-tag-middel-sel";
		var obj6 = document.getElementById("tag1-right");
		obj6.className = "tab-tag-right-sel";
		
		var obj_a = document.getElementById("fieldOne");
		obj_a.style.display = "none";
		var obj_b = document.getElementById("fieldTwo");
		obj_b.style.display = "";
		var tab = document.getElementById("mainTable");
		tab.className = "categorySet";
		tab.width = "100%";
	}
	
	    function chooseFlowPerm(boundName,permItem){
    
    	var oper_str = "";
    	var opt = null;
    	var ele = null;
    	var receivedObj = null;
    	var value = "";
    	var returnOptValue = "";
    	var eleOpt = null;
    
    	var type = document.getElementById("type");
    	var operation_str = document.getElementById("operation_str");
    	
    	//根据boundName(shenpi,niwen,...)动态拼接成元素的Id
    	opt = document.getElementById("choosedOperation_"+permItem);

    	//首先取出该处理意见所绑定的权限名称
    	var array = new Array();
    	
    	if(opt.options.length!=0){
    	 for(var x=0;x<opt.options.length;x++){
    	 	
    	 	if(opt.options[x].itemList){
    	 	var temp_str = opt.options[x].itemList.split(",");
    	 	if(temp_str.length>=1){
    	 		for(var i=0;i<temp_str.length;i++){
    	 			array[x] = temp_str[i];
    	 			x++;
    	 		}
    	 	}
    	 	}else{
    			var tempValue = "("+opt.options[x].value+")";
				array[x] = tempValue; 	    	 	
    	 	}
  	  	 }
  	  }
       receivedObj = v3x.openWindow({
     	   url: "${edocForm}?method=operationChoose&type="+type.value+"&boundName="+encodeURI(boundName)+"&permItem="+permItem,
     	   width:"350",
    	   height:"370",
    	   scrollbars: false,
		   resizable : 'no'
  	  });
  	  if(receivedObj!=null && opt!=null){

		ele = document.getElementById(boundName);

		opt.length = 0;
		
  	  	var option = null;
  	  	for(var i=0;i<receivedObj.length;i++){
  	  		option=document.createElement("OPTION");
	     	opt.options.add(option);
		 	option.value=receivedObj[i][0];
		  	option.text=receivedObj[i][1];
		  	value += receivedObj[i][1];
		  	value += ",";
		  	returnOptValue += receivedObj[i][0];
		  	returnOptValue += ",";
		  	oper_str += "("+receivedObj[i][0]+")";
  	  	 }
  	  	 

  	  	   ele.value = value.substring(0, value.length-1);;
  	  	   
  	  	  returnOptValue =  returnOptValue.substring(0,returnOptValue.length-1);
  	  	  
  	  	  document.getElementById("returnOperation_"+boundName).value = returnOptValue;
  	  	     
  	  	   //把返回的结果与选择之前的结果相比，如果之前含有的权限没有了，即撤销了选择，存入一个新的newArray中
  	  	   var newArray = new Array();
  	  	    
  	  	   for(var i=0;i<array.length;i++){
  	  	   		var m = oper_str.search('('+array[i]+')');
  	  	   		 if(m == -1){
  	  	   			newArray[i] = array[i];
  	  	   		}
  	  	   }
   	      	   
    	    operation_str.value += oper_str;
    	    
    	    var final = operation_str.value;
    	    

    	    
    	    //在节点权限已选择池中依次相比，如果发现有newArray(撤销的权限)，从选择池中删除，下次再次点击选择权限就不会判断撤销的权限

    	    for(var i=0;i<newArray.length;i++){
    	    	final = final.replace(newArray[i], "");
    	    }
    	    
    	    //已选择池赋值
    	    
    	     operation_str.value = final;

    	    /*
  	  		var operation_opt = document.getElementById("operation");

/*
			var hidden_operation_opt = document.getElementById("hidden_operation");
				operation_opt.options.length = 0;
  	  		for(var i=0;i<hidden_operation_opt.length;i++){
  	  			var option=document.createElement("OPTION");
	     		operation_opt.options.add(option);
		 		option.value=hidden_operation_opt.options[i].value;
		  		option.text=hidden_operation_opt.options[i].text;  
  	  		   }
					

			if(opt.options.length!=0 && operation_opt.options.length!=0){
				for(var i=0;i<operation_opt.options.length;i++){
					for(var j=0;j<opt.options.length;j++){
						if(operation_opt.options[i]!=null && opt.options[j]!=null && operation_opt.options[i].value==opt.options[j].value){
							operation_opt.options.remove(i);
							}
						}
					}
				}
		*/
		}


				
  
    }	
	function buttondis(){
		var saveFormTemp = document.all("modifysubmit");
		if(saveFormTemp != null){
			saveFormTemp.disabled="true";
		}
	}
	function buttondnois(){
	 var saveFormTemp = document.all("modifysubmit");
	 if(saveFormTemp != null){
			saveFormTemp.disabled=false;
		}
	}
	function setPeopleFields(elements){
		if(elements){
			var obj1 = getNamesString(elements);
			var obj2 = getIdsString(elements,false);
			document.getElementById("domain").value = getNamesString(elements);
			document.getElementById("grantedDomainId").value = getIdsString(elements,true);
		}
	}
</script>
</head>
<c:set value="${v3x:showOrgEntitiesOfIds(aclIds, 'Account',  pageContext)}" var="authStr"/>
<c:set value="${v3x:parseElementsOfIds(aclIds, 'Account')}" var="authIds"/>
<v3x:selectPeople id="grantedDomainId" panels="Account" selectType="Account" jsFunction="setPeopleFields(elements)" originalElements="${authIds}" minSize="0"/>
<body onload='edocFormDisplay("${fileId}","${v3x:escapeJavascript(fileName)}","${createDate}")'>

<script type="text/javascript">showOriginalElement_grantedDomainId = true;</script>
<div class="newDiv">
<form id="modifyForm" name="modifyForm" method="POST">
<input type="hidden" name="method_type" id="method_type" value="${method_type}" />
<input type="hidden" name="att_fileUrl" id="att_fileUrl" value="${att_fileUrl}">
<input type="hidden" name="att_createDate" id="att_createDate" value="${att_createDate}">
<input type="hidden" name="att_mimeType" id="att_mimeType" value="${att_mimeType}">
<input type="hidden" name="att_filename" id="att_filename" value="${att_filename}">
<input type="hidden" name="att_needClone" id="att_needClone" value="${att_needClone}">
<input type="hidden" name="att_description" id="att_description" value="${att_description}">
<input type="hidden" name="att_type" id="att_type" value="${att_type}">
<input type="hidden" name="att_size" id="att_size" value="${att_size}">
<input type="hidden" name="id" id="id" value="${bean.id}">
<input type="hidden" name="isSystem" id="isSystem" value="${bean.isSystem}">
<input type="hidden" id="file_name" name="file_name" value="">
<input type="hidden" id="content" name="content" value="" >
<input type="hidden" id="element_id_list" name="element_id_list" value="<c:out value='${element_id_list}' escapeXml='true'/>" >
<input type="hidden" id="mx" name="mx">
<input type="hidden" id="appName" name="appName" value="<%=ApplicationCategoryEnum.edoc.getKey()%>">
<input type="hidden" id ="orgAccountId" name="orgAccountId" value="${v3x:currentUser().loginAccount}">

<input type="hidden" id="original_xml" name="original_xml" value="${original_xml}" >
<input type="hidden" name="attachmentStr" value="">
<input type="hidden" name="edocFormStatusId" id="edocFormStatusId" value="${edocFormStatusId}">
<!-- 程炯 2012-7-20 太原市政府项目 begin -->
<input type="hidden" name="edocPostStr" id="edocPostStr" value="<c:out value='${edocPostStr}'/>" />
<input type="hidden" name="edocPostIds" id="edocPostIds" value="<c:out value='${edocPostIds}'/>" />
<input type="hidden" name="edocPostIdNames" id="edocPostIdNames" value="<c:out value='${edocPostIdNames}'/>" />
<!-- end -->
<c:choose>
	<c:when test="${bean.content ==''}">
		<c:set value="empty" var="content" />
	</c:when>
	<c:otherwise>
		<c:set value="existed" var="content" />
	</c:otherwise>
</c:choose>
		<c:choose>
				<c:when test="${type == 0}">
						<c:set value="edoc.formstyle.dispatch" var="msgType" />
						<c:set value="fileupload.edocform.send" var="popTitle" />
				</c:when>
				<c:when test="${type == 1}">
						<c:set value="edoc.formstyle.receipt" var="msgType" />	
						<c:set value="fileupload.edocform.rec" var="popTitle" />
				</c:when>
				<c:when test="${type == 2}">
						<c:set value="edoc.formstyle.qianbao" var="msgType" />	
						<c:set value="fileupload.edocform.sign" var="popTitle" />
				</c:when>
		</c:choose>
<table border="0" id="mainTable" name="mainTable" cellpadding="0" cellspacing="0" width="100%" height="100%" align="center" class="categorySet-bg">
	<tr align="center">
		<td height="8" class="detail-top" colspan="2">
			<script type="text/javascript">
			getDetailPageBreak(); 
		</script>
		</td>
	</tr> 
	<tr>
		<td colspan="2">
		<div class="scrollList">
			<table cellpadding="0" cellspacing="0" width="100%" height="100%" border="0">
			    <tr>
			  	<td width="20%" valign="top">
			 		<table width="80%" border="0" cellspacing="0" cellpadding="3" align="center">
			 			<tr><td class="label" align="left"><fmt:message key="edoc.form.name" />&nbsp;:&nbsp;</td></tr>
			 			<tr>	
			 				<td class="new-column" nowrap="nowrap">
								<input name="name" type="text" id="name" deaultValue="${bean.name}" maxSize="125" 
								inputName="<fmt:message key="edoc.form.name" />"

								validate="notNull,maxLength" <c:if test="${param.flag == 'readonly' or bean.isSystem or isOuterAccountAcl}"> disabled </c:if> 

								value="<c:out value="${bean.name}" escapeXml="true" default='${bean.name}' />"
								  />
								  <c:if test="${param.flag == 'readonly' or bean.isSystem or isOuterAccountAcl}">
								  	<input name="name" type="hidden" value="${bean.name}"/>
								  </c:if>
							</td>	
						</tr>
			 			<tr><td class="label" align="left"><fmt:message key="edoc.form.sort" />&nbsp;:&nbsp;</td></tr>
			 			<tr>	
			 				<td class="new-column" nowrap="nowrap">	
							<input type="hidden" id="type" name="type" value="${type}">
							<input type="hidden" id="sort" value="${msgType }" >				
							<c:choose>
								<c:when test="${type == 0}">
									<input type="text" id="sort" name="sort" value="<fmt:message key='${msgType}' />" readonly disabled="disabled">
								</c:when>
								<c:when test="${type == 1}">
									<input type="text" id="sort" name="sort" value="<fmt:message key='${msgType}' />" readonly  disabled="disabled">						
								</c:when>
								<c:when test="${type == 2}">
									<input type="text" id="sort" name="sort" value="<fmt:message key='${msgType}' />" readonly  disabled="disabled">
								</c:when>
							</c:choose>
							</td>	
						</tr>
			 			<tr><td class="label" align="left"><fmt:message key="edoc.form.defaultform" />&nbsp;:&nbsp;</td></tr>
			 			<tr>	
			 				<td class="new-column" nowrap="nowrap">
			 				<c:choose>
			 				<c:when test='${bean.isDefault==true}'>
			 				<label for="isDefault1">
			 				<input type="radio" name="isDefault" id="isDefault1" value="1" checked <c:if test="${param.flag == 'readonly'}"> disabled </c:if> /> <fmt:message key="edoc.form.yes" />	
			 				</label>
			 				<label for="isDefault2">
			 				<input type="radio" name="isDefault" id="isDefault2" value="0" <c:if test="${param.flag == 'readonly'}"> disabled </c:if>  /> <fmt:message key="edoc.form.no" />
			 				</label>
			 				</c:when>
			  				<c:when test='${bean.isDefault==false}'>
			  				<label for="isDefault1">
			 				<input type="radio" name="isDefault" id="isDefault1" value="1" <c:if test="${param.flag == 'readonly'}"> disabled </c:if> /> <fmt:message key="edoc.form.yes" />	
			 				</label>
			 				<label for="isDefault2">
			 				<input type="radio" name="isDefault" id="isDefault2" value="0" checked <c:if test="${param.flag == 'readonly' }"> disabled </c:if> /> <fmt:message key="edoc.form.no" />
			 				</label>
			 				</c:when>
			   				<c:otherwise>
			   				<label for="isDefault1">
			 				<input type="radio" name="isDefault" id="isDefault1" value="1" <c:if test="${param.flag == 'readonly'}"> disabled </c:if> /> <fmt:message key="edoc.form.yes" />	
			 				</label>
			 				<label for="isDefault2">
			 				<input type="radio" name="isDefault" id="isDefault2" value="0" checked <c:if test="${param.flag == 'readonly'}"> disabled </c:if> /> <fmt:message key="edoc.form.no" />
			 				</label>
			 				</c:otherwise>
			 				</c:choose>
							</td>	
						</tr>
			 			<tr><td class="label" align="left"><fmt:message key="edoc.form.currentstatus" />&nbsp;:&nbsp;</td></tr>
			 			<tr>		
							<td class="new-column" nowrap="nowrap">
			 				<c:choose>
			 				<c:when test="${bean.status == 0}">
			 				<label for="status1">
			 				<input type="radio" id="status1" name="status" value="1" <c:if test="${param.flag == 'readonly'}"> disabled </c:if> /> <fmt:message key="edoc.element.enabled" />	
			 				</label>
			 				<label for="status2">
			 				<input type="radio" id="status2" name="status" value="0" checked <c:if test="${param.flag == 'readonly' }"> disabled </c:if> /> <fmt:message key="edoc.element.disabled" />
			 				</label>
							</c:when>
							<c:when test="${(bean.status == 1)||(status==1)}">
							<label for="status1">
			 					<input type="radio" id="status1" name="status" value="1" checked <c:if test="${param.flag == 'readonly' }"> disabled </c:if> /> <fmt:message key="edoc.element.enabled" />	
			 				</label>
			 				<label for="status2">
			 					<input type="radio" id="status2" name="status" value="0" <c:if test="${param.flag == 'readonly' }"> disabled </c:if> /> <fmt:message key="edoc.element.disabled" />
			 				</label>
							</c:when>
							<c:otherwise>
							<label for="status1">
							<input type="radio" id="status1" name="status" value="1" <c:if test="${param.flag == 'readonly'}"> disabled </c:if> /> <fmt:message key="edoc.element.enabled" />	
							</label>
							<label for="status2">
			 				<input type="radio" id="status2" name="status" value="0" checked <c:if test="${param.flag == 'readonly'}"> disabled </c:if> /> <fmt:message key="edoc.element.disabled" />
			 				</label>
							</c:otherwise>
							</c:choose>
							</td>	
						</tr>
						<%--目前只有发文支持自定义分类 --%>
						<c:if test="${bean.type==0 }">
						<tr><td class="label" align="left"><fmt:message key='edoc.category.send'/>&nbsp;:&nbsp;</td></tr>
			 			<tr> 
			 				<td class="new-column" nowrap="nowrap">
			 				<select name="edocCategory" id="edocCategory" style="width:80" ${(param.flag=="" || param.flag==null) && !isOuterAccountAcl ?"":"disabled"}>
			 					<c:if test="${isOuterAccountAcl != true}">
								<c:forEach items="${categories }" var="c">
			 						<option value="${c.id }" ${bean.subType==c.id?"selected":""}>${c.name }</option>
			 					</c:forEach>
								</c:if>
			 				</select>
			 				&nbsp;&nbsp;<input type="button" value="<fmt:message key='edoc.category.handle'/>" onclick="showCategory(0)"  ${(param.flag=="" || param.flag==null) && !isOuterAccountAcl ?"":"disabled"}>
							</td>	
						</tr>
						</c:if>
						<c:if test="${type==0}">
                        <tr><td class="label" align="left"><fmt:message key="edoc.form.required" />&nbsp;:&nbsp;</td></tr>
                        <tr>
                            <td>
                                <div style="background-color:#FFFFFF; border: 1 solid #E3E9EF; border-top-color:#ABADB3; width:150px; height:150px; OVERFLOW-Y:scroll; OVERFLOW-X:hidden;" >
                                    <table>
                                        <c:forEach items="${formElements}" var="formElement">
                                            <tr>    
                                                <td>
                                                    <c:choose> 
                                                        <c:when test="${!formElement.access || isOuterAccountAcl}">
                                                            <input type='checkbox' name ="${formElement.elementId}" disabled="disabled" style='height:15px;'>
                                                        </c:when>
                                                        <c:otherwise>
                                                        	<c:choose>
                                                        		<c:when test="${formElement.elementId==1}">
		                                                            <input type='checkbox' <c:if test="${(param.flag == 'readonly') || (formElement.elementId==1)}"> disabled </c:if> name ="${formElement.elementId}" <c:if test="${(formElement.required) || (formElement.elementId==1)}">checked="checked"</c:if> style='height:15px;'>
                                                        		</c:when>
                                                        		<c:otherwise>
		                                                            <input type='checkbox' <c:if test="${param.flag == 'readonly'}"> disabled </c:if> name ="${formElement.elementId}" <c:if test="${formElement.required}">checked="checked"</c:if> style='height:15px;'>
                                                        		</c:otherwise>
                                                        	</c:choose>
                                                        </c:otherwise>
                                                    </c:choose> 
                                                    <label>
                                                        <c:if test="${formElement.systemType}">
                                                            <fmt:message key="${formElement.elementName}"/>
                                                        </c:if>
                                                        <c:if test="${!formElement.systemType}">
                                                            ${v3x:getLimitLengthString(formElement.elementName,12,'...')}
                                                        </c:if>
                                                    </label>
                                                </td>                                                            
                                            </tr>
                                        </c:forEach>
                                    </table>
                                </div>
                            </td>
                        </tr>
                        </c:if>
						<c:if test ="${!(v3x:getSysFlagByName('sys_isEnterpriseVer')=='true')}">
							<tr>
								<td class="label" align="left"><fmt:message key="edoc.doctemplate.grant" />&nbsp;:&nbsp;</td>
							</tr>
							<tr>
								<td class="new-column" width="75%" nowrap="nowrap">
									<textarea id="domain" name="depart" value="" <c:if test="${param.flag != 'readonly' and  !bean.isSystem and !isOuterAccountAcl}">class="cursor-hand" onclick ="selectPeopleFun_grantedDomainId();"</c:if>  rows="4"
									inputName="<fmt:message key="edoc.doctemplate.grant" />" validate=""
									readonly = "true" style="width:100%"
									>${authStr}</textarea>
								</td>
								<input type="hidden" id="grantedDomainId" name="grantedDomainId" value="${grantedDepartId==null?authIds:grantedDepartId}" />
							</tr>
						</c:if>
						<tr><td class="label" align="left"><fmt:message key="edoc.form.description" />&nbsp;:&nbsp;</td></tr>
			 			<tr>	

								<td class="new-column" width="100%" nowrap="nowrap"><div width="100%"><textarea <c:if test="${param.flag == 'readonly' or bean.isSystem or isOuterAccountAcl}"> readonly = "true"</c:if>
								class="input-100per" id="description" name="description" rows="4" maxSize="80" validate="maxLength"
								inputName="<fmt:message key="edoc.form.description" />"
								cols="20" value="<c:out value="${bean.description}" escapeXml="true" default='${bean.description}' />">${bean.description}</textarea></div></td>
						</tr>
			 		</table>
			  	</td>
			  	<div class=""><v3x:fileUpload     attachments="${attachments}"  canDeleteOriginalAtts="true"  extensions="xsn"   encrypt="false"  popupTitleKey="${popTitle}"/>
			  						<script>
			var fileUploadQuantity = 1;
			</script></div>
			  	<td width="80%">
				<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" align="center" class="categorySet-bg">
				<tr>
					<td height="8"></td>
				</tr>
				<tr>
					<td class="categorySet-head" height="23">
						<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
						 		<td valign="bottom" height="26" class="tab-tag">
									<div class="div-float">
									<div id="tag0-left"   class="tab-tag-left-sel"></div>
									<div id="tag0-middel" class="tab-tag-middel-sel" onclick="fieldChoose();">
									<fmt:message key='edoc.form.formpreview' /></div>
									<div id="tag0-right"  class="tab-tag-right-sel"></div>
									
									<div class="tab-separator"></div>
								
									<div id="tag1-left" class="tab-tag-left"></div>
									<div id="tag1-middel" class="tab-tag-middel" onclick="chooseReverse();">
									<fmt:message key='edoc.form.flowperm.bound' /></div>
									<div id="tag1-right" class="tab-tag-right"></div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			 	<tr>
					<td class="categorySet-head">
						<div class="categorySet-body" id="fieldOne" name="fieldOne" >
							<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
			  <tr>
			    <td width="90%" align="left" valign="top">
			    
			    <div id="download" name="download"></div>
			    	<div name="divA" id="divA" style="display:none;"><A href="###" id="upload" name="upload" onclick="newcategory();" onMousemove="showAttention('attention');" onMouseleave="hideAttention('attention');"><fmt:message key="common.lable.upload.prefix" /><fmt:message key="${msgType}" /></A></p></div>
			    
			    	<p>
							<DIV id="attention" style="padding-left:5px;BORDER:#CCCCCC 1px			solid;background-color:#97E4FE;display:none;POSITION:absolute;LINE-HEIGHT:20px;filter:alpha(opacity=70);">
						<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
								<tr>
									<td>*
									<fmt:message key="common.label.attention.typeconfirm" />&nbsp;[&nbsp;<fmt:message key="${msgType}" />&nbsp;]
									</td>
								</tr>
						</table>
					</DIV>
					</p>
			    	<fieldset style="width:95%" align="center"><legend><fmt:message key="${msgType}" /><fmt:message key="common.lable.preview.prefix" /></legend>
			
					
					 <div class="hidden">
						<textarea id="xml" cols="40" rows="10">${xml}</textarea>
					 </div>
					 <div class="hidden">
					   	<textarea id="xsl" cols="40" rows="10">${xsl}</textarea>
					 </div>
			
					<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
					<tr><td>
						<div id="html" name="html" style="height:0px;" ></div>
						<div id="img" name="img" style="height:0px;"></div>	 
						<div style="display:none">
						<textarea name="submitstr" id="submitstr" cols="80" rows="20"></textarea><br/>
						</div>
					</td>
					</tr>
					</table>		
					</fieldset>
				</td>
			   </tr>	
			</table>
			<p></p>
						</div>	
						<table>
							<tr>
								<td>
									<fieldset style="padding: 20px"><legend> <b><fmt:message key="edoc.form.flowperm.process.sortType.set" /></b></legend> <br>
									<table>
										<tr>
											<td>
												<table>
													<tr>
														<td>
															<!-- lijl添加(意见保留设置 ) -->
															<fmt:message key="edoc.form.flowperm.setup" />:
														</td>
														<td>
															<!--lijl注销 <input type="checkbox" name="showLastOptionOnly" id="showLastOptionOnly" <c:if test="${param.flag == 'readonly'}"> disabled="disabled"</c:if>/><LABEL for="showLastOptionOnly"><fmt:message key="edoc.form.flowperm.showLastOptionOnly" /></LABEL> -->
															<!-- lijl添加(全流程保留最后一次意见 )-->
															<input type="radio" id="optionType1" name="optionType" value="1" checked="checked" <c:if test="${param.flag == 'readonly'}"> disabled="disabled"</c:if>/><LABEL for="optionType1"><fmt:message key="edoc.form.flowperm.showLastOptionOnly" /></LABEL>
														</td>
													</tr>
													<tr>
														<td>&nbsp;</td>
														<td>
															<!-- lijl添加(全流程保留所有意见) -->
															<input type="radio" id="optionType2" name="optionType" value="2" <c:if test="${param.flag == 'readonly'}"> disabled="disabled"</c:if>/><LABEL for="optionType2"><fmt:message key="edoc.form.flowperm.all" /></LABEL>
														</td>
													</tr>
													<tr>
														<td>&nbsp;</td>
														<td>
															<!-- lijl添加(退回时办理人选择覆盖方式，其他情况保留最后意见) -->
															<input type="radio" id="optionType3" name="optionType" value="3" <c:if test="${param.flag == 'readonly'}"> disabled="disabled"</c:if>/><LABEL for="optionType3"><fmt:message key="edoc.form.flowperm.client" /></LABEL>
														</td>
													</tr>
													<tr>
														<td>&nbsp;</td>
														<td>
															<!-- lijl添加(退回时办理人选择覆盖方式，其他情况保留所有意见) -->
															<input type="radio" id="optionType4" name="optionType" value="4" <c:if test="${param.flag == 'readonly'}"> disabled="disabled"</c:if>/><LABEL for="optionType4"><fmt:message key="edoc.form.flowperm.client1" /></LABEL>
														</td>
													</tr>
													<!-- lijl添加<script>...</sript>用来显示选择的意见 -->
													<script>
													  var webOptionSetStr="${bean.webOpinionSet}";
													  if(webOptionSetStr!=null&&webOptionSetStr!=""){
														  var webOptionSet = webOptionSetStr.split(",");
														  var optionType=null;
														  if(webOptionSet[0]!='0'){
															  optionType=webOptionSet[0];
														  }else{
															  optionType='1';
														  }
														  if(webOptionSet[3]!="0"){
															  optionType=webOptionSet[3];
														  }
														  document.getElementById("optionType"+optionType).checked="checked";
													   }
													</script>
												</table>
											</td>
										</tr>
										<tr>
											<td>
												<table>
													<tr>
														<td><fmt:message key="edoc.form.flowperm.showOpinionSignDploy" /></td>
														<td>
															<div class="div-float">
																<input type="radio" id="radio3" name="showOrgnDept" value="0" checked="checked" <c:if test="${param.flag == 'readonly'}"> disabled="disabled"</c:if> onclick="showAcc(this)"/><LABEL for="radio3"><fmt:message key="edoc.form.flowperm.showDept" /></LABEL>
															</div>
														</td>
													</tr>
													<tr>
														<td>&nbsp;</td>
														<td><input type="radio" id="radio4" name="showOrgnDept" value="1" <c:if test="${param.flag == 'readonly'}"> disabled="disabled"</c:if> onclick="showAcc(this)"/><LABEL for="radio4"><fmt:message key="edoc.form.flowperm.showOrgan" /></LABEL></td>
													</tr>
													<!-- 程炯 太原市政府项目 2012-7-20 begin -->
													<tr>
														<td>&nbsp;</td>
														<td><input type="radio" id="radio5" name="showOrgnDept" value="2" <c:if test="${param.flag == 'readonly'}"> disabled="disabled"</c:if> onclick="showAcc(this)"/><LABEL for="radio5">显示职务</LABEL></td>
													</tr>
													<tr>
														<td>&nbsp;</td>
														<td><textarea id="viewStr" rows="5" cols="60" style="color:gray;display:none" <c:if test="${param.flag == 'readonly'}"> disabled="disabled"</c:if> onclick="selectPeopleFun_edocSendAcc()">${v3x:showOrgEntitiesOfTypeAndId(edocPostStr,pageContext)}</textarea>
															<v3x:selectPeople id="edocSendAcc" panels="Post" selectType="Post" departmentId="${sessionScope['com.seeyon.current_user'].departmentId}" jsFunction="selectPost(elements)" viewPage=""  showAllAccount="false" maxSize="-1" minSize="0" />
														</td>
														<input type="hidden" id = "postId" name = "postId"/>
													</tr>
													<!-- lijl添加<script>...</sript>用来显示选择的意见 -->
													<script>
													  var webOptionSetStr="${bean.webOpinionSet}";
													  if(webOptionSetStr!=null&&webOptionSetStr!=""){
														  var webOptionSet = webOptionSetStr.split(",");
														  if(webOptionSet[1]=="0"){
														  	document.getElementById("radio3").checked="checked";
														  }
														  if(webOptionSet[1]=="1"){
															document.getElementById("radio4").checked="checked";
														  }
														  if(webOptionSet[1]=="2"){
															document.getElementById("radio5").checked="checked";
															document.getElementById("viewStr").style.display = "block";
														  }
													   }
													   function selectPost(elements){
														   var recUnitObj=window.event.srcElement;
														   recUnitObj.value=getNamesString(elements);
														 
														   var i = document.getElementById("postId");
														   i.value = getIdsString(elements,true);
						
													   }
													   function showAcc(e){
														   if(e.id == "radio5"){
														     document.getElementById("viewStr").style.display = "block";
														   }
														   else{
															 document.getElementById("viewStr").style.display = "none";
														   }
													   }
													</script>
													<!-- end -->
												</table>
											</td>
										</tr>
										
										<tr>
											<td>
												<table>
													<tr>
														<td><fmt:message key="edoc.form.flowperm.showDateTimeFormat" /></td>
														<td>
															<div class="div-float">
																<input type="radio" id="radio1" name="dealTimeFormt" value="0" checked="checked" <c:if test="${param.flag == 'readonly'}"> disabled="disabled"</c:if>/><LABEL for="radio1"><fmt:message key="edoc.form.flowperm.dealDateTimeFormt" /></LABEL>
															</div>
														</td>
													</tr>
													<tr>
														<td>&nbsp;</td>
														<td><input type="radio" id="radio2" name="dealTimeFormt" value="1" <c:if test="${param.flag == 'readonly'}"> disabled="disabled"</c:if>/><LABEL for="radio2"><fmt:message key="edoc.form.flowperm.dealDateFormt" /></LABEL></td>
													</tr>
												</table>
											</td>
										</tr>
									</table>
									</fieldset>
								</td>
							</tr>
							<tr>
								<td>
									<div class="categorySet-body-edocform" id="fieldTwo" name="fieldTwo" style="display:hidden" >
										<table width="70%" border="1" cellspacing="0" cellpadding="5" align="center">
										<tr style="background-color:#D3D3D3"><th align="left"><fmt:message key="edoc.form.flowperm.process.label" /></th><th align="left"><fmt:message key="edoc.form.flowperm.name.label" /></th><th><fmt:message key="edoc.form.flowperm.operation.label" /></th><th align="left"><fmt:message key="edoc.form.flowperm.process.sortType" /></th></tr>
										<c:forEach items="${processList}" var="bean">
											<tr>
												<td width="30%">${bean.permName}</td>
												<td width="50%"><input readonly="readonly" type="text" style="width:100%;height:100%;" name="${bean.permItem}" id="${bean.permItem}" value="${bean.permItemName}"></td>
												<td width="20%" align="center"><input type="button" value="<fmt:message key='edoc.button.editoperate.label' />" <c:if test="${param.flag == 'readonly' || param.isSystem == 'true'}"> disabled </c:if> onclick="chooseFlowPerm('${bean.permItem}','${bean.permItem}');" />
												<div style="display:none">
												<select id="choosedOperation_${bean.permItem}" name="choosedOperation_${bean.permItem}"
													multiple="multiple"  size="4"  class="input-100per">
													<option value="${bean.permItem}" itemList="${bean.permItemList}">${bean.permItemName}</option>
												</select>
													<input type="returnOperation_${bean.permItem}" name="returnOperation_${bean.permItem}" value="${bean.permItemList}" type="hidden">
												</div>
												</td>
												<td>
													<select id="sortType_${bean.permItem}" name="sortType_${bean.permItem}" <c:if test="${param.flag == 'readonly'}"> disabled="disabled"</c:if>>
													<c:choose>
														<c:when test="${bean.sortType == '0'}">
															<option value="0" selected="selected"><fmt:message key="edoc.form.flowperm.process.sortType.dealtime.asc" /></option>
														</c:when>
														<c:otherwise>
															<option value="0"><fmt:message key="edoc.form.flowperm.process.sortType.dealtime.asc" /></option>
														</c:otherwise>
													</c:choose>
													<c:choose>
														<c:when test="${bean.sortType == '1'}">
															<option value="1" selected="selected"><fmt:message key="edoc.form.flowperm.process.sortType.dealtime.desc" /></option>
														</c:when>
														<c:otherwise>
															<option value="1"><fmt:message key="edoc.form.flowperm.process.sortType.dealtime.desc" /></option>
														</c:otherwise>
													</c:choose>
													
													
													<%--puyc --%>
													<c:choose>
														<c:when test="${bean.sortType == '4'}">
															<option value="4" selected="selected"><fmt:message key="edoc.form.flowperm.process.sortTypeAsc.orgLevel" /></option>
														</c:when>
														<c:otherwise>
															<option value="4"><fmt:message key="edoc.form.flowperm.process.sortTypeAsc.orgLevel" /></option>
														</c:otherwise>
													</c:choose>
													
													<%--//puyc --%>
													
												  <c:choose>
														<c:when test="${bean.sortType == '2'}">
															<option value="2" selected="selected"><fmt:message key="edoc.form.flowperm.process.sortTypeDesc.orgLevel" /></option>
														</c:when>
														<c:otherwise>
															<option value="2"><fmt:message key="edoc.form.flowperm.process.sortTypeDesc.orgLevel" /></option>
														</c:otherwise>
													</c:choose>

													<c:choose>
														<c:when test="${bean.sortType == '3'}">
															<option value="3" selected="selected"><fmt:message key="edoc.form.flowperm.process.sortType.deptSortId" /></option>
														</c:when>
														<c:otherwise>
															<option value="3"><fmt:message key="edoc.form.flowperm.process.sortType.deptSortId" /></option>
														</c:otherwise>
													</c:choose>
													</select>
												</td>
											</tr>
										</c:forEach>
										</table>
										<table width="70%" border="0" cellspacing="0" cellpadding="5" align="center">
											<tr><td colspan="3"><font color="green">*<fmt:message key="edoc.form.otheropinion.notice" /></font></td></tr>
										</table>
									</div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				
			   </table>
			   </div>
				</td>	
				</tr>
			</table>
		</td>
	</tr>

	<c:if test="${param.flag != 'readonly'}"> 
	<tr>
		<td height="42" align="center" class="bg-advance-bottom" colspan="2">
		<div align="center">
		<input
			type="button"
			value="<fmt:message key='common.button.ok.label' bundle="${v3xCommonI18N}" />"
			class="button-default-2" id= "modifysubmit" onclick="modify_submit('${listStr}','${content}');">
			<input type="button"
			onclick="parent.document.location.reload();"
			value="<fmt:message key='common.button.cancel.label' bundle="${v3xCommonI18N}" />"
			class="button-default-2">
		</div>
		</td>
	</tr>	
	</c:if>
</table>
<div style="display:none">
	<select id="operation" name="operation"
				multiple="multiple"  size="4"  class="input-100per">
							<c:forEach var="flowPerm" items="${flowPermList}">
								<option value="${flowPerm.name}">
								<c:if test="${flowPerm.type == 0}">
									<fmt:message key="${flowPerm.label}" bundle="${v3xCommonI18N}" />
								</c:if>
								<c:if test="${flowPerm.type == 1}">
										${flowPerm.name}
								</c:if>								
				</option>
		</c:forEach>
	</select>
	<select id="hidden_operation" name="hidden_operation"
				multiple="multiple"  size="4"  class="input-100per">
							<c:forEach var="flowPerm" items="${flowPermList}">
								<option value="${flowPerm.name}">
								<c:if test="${flowPerm.type == 0}">
									<fmt:message key="${flowPerm.label}" bundle="${v3xCommonI18N}" />
								</c:if>
								<c:if test="${flowPerm.type == 1}">
										${flowPerm.name}
								</c:if>								
				</option>
		</c:forEach>
	</select>
</div>
<input type="hidden" name="operation_str" id="operation_str" value="${operation_str}"> 
</form>
</div>
<div class="hidden">
<iframe id="temp_iframe" name="temp_iframe">&nbsp;</iframe>
</div>
<script>
<!--
    if(${param.flag != 'readonly' || bean.content == '' }){
		if(${!bean.isSystem and !isOuterAccountAcl}){
			var divA = document.getElementById("divA");
			if(divA){
				divA.style.display = "";
			}
		}
    }
	
	//提交后保存公文单信息
	var attachmentInputs = document.getElementById("attachmentInputs");
	if(attachmentInputs) 
		attachmentInputs.innerHTML = "${v3x:escapeJavascript(param.attachmentStr)}";


	//根据意见元素设置勾选意见元素	
	var optionFormatSet = "${bean.webOpinionSet}";
	var formSetArray = optionFormatSet.split(",");
	if(formSetArray.length!=0){
		//var check1 = document.getElementById("showLastOptionOnly");lijl注销
		//var check2 = document.getElementById("showDept");lijl注销
		var radios = document.getElementsByName("dealTimeFormt");
		//if("1"==formSetArray[0]){lijl注销
			//check1.checked = true;
		//}
		//if("1"==formSetArray[1]){lijl注销
			//check2.checked = true;
		//}
		if("1"==formSetArray[2]){
			radios[1].checked = true;
		}else{
			radios[0].checked = true;
		}
	}
	//-->
</script>
</body>
</html> 